package org.ccay.excel.meta;

import java.io.OutputStream;

import org.springframework.core.io.Resource;

import org.ccay.core.exception.ApplicationException;

/**
 * Excel元数据管理器。
 * 	
 * @author chaowangbang
 * @since Mar 19, 2012
 */
public interface IExcelMetaManager {
	
	/** 
	 * 获取resource对应的ExcelMeta
	 * 	
	 * @author chaowangbang
	 * @since Mar 19, 2012
	 * @param resource
	 * @return
	 * @throws XMLStreamException 
	 * @throws IOException 
	 * @throws ExcelApplicationException 
	 * @throws ApplicationException 
	 */
	public ExcelMeta getExcelMeta(Resource resource) throws ApplicationException;
	
	/**
	 * 根据excelType获取ExcelMeta.
	 * 
	 * 规则：
	 * excelType对应的配置文件为config/excelType.excelImport.xml或者config/excelType.excel.xml
	 * 	
	 * @author chaowangbang
	 * @since Mar 19, 2012
	 * @param excelType
	 * @return
	 * @throws ApplicationException 
	 */
	public ExcelMeta getExcelMeta(String excelType) throws ApplicationException;
	
	/** 根据excelType对应的ExcelMeta生成Excel模板
	 * 	
	 * @author chaowangbang
	 * @since Mar 19, 2012
	 * @param excelType
	 * @return
	 * @throws ApplicationException 
	 */
	public void generateExcelTemplate(String excelType, OutputStream output) throws ApplicationException;
	
	/**
	 * 
	 * 根据ExcelMeta生成Excel模板
	 * @param excelMeta
	 * @param output
	 * @throws ApplicationException
	 * Created：2013-7-20
	 * @author chaowangbang
	 */
	public void generateExcelTemplate(ExcelMeta excelMeta, OutputStream output) throws ApplicationException;

}
